Introduction

Gate-model quantum computers are realized by unitary operators (quantum gates) and quantum states1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29. As the technological limits of current semiconductor technologies will be reached within the next few years30,31,32,33,34,35,36,37,38,39,40, fundamentally different solutions provided by quantum technologies will be significant in the experimental realization of future computations15,16,17,18,31,32,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72. A quantum computer is set up with a quantum gate structure, that is, via a set of unitary operators. These quantum gates can realize different quantum operations and can be defined on different numbers of input quantum states15,16,17,18,41,42,43,45,52,53. In a quantum computer environment, the depth of the quantum gate structure refers to the number of time steps (time complexity) required for the quantum operations making up the circuit to run on the quantum hardware15,16,17,18,41,42,43,45,52,53,54,55,56,57,58,59. A crucial problem here is the time complexity reduction of the quantum gate structure of the quantum computer. Practically, this problem is such that an equivalent quantum state of the output quantum state of the original the reference quantum circuit (e.g., non-reduced time complexity circuit) can be obtained using a reduced time complexity quantum gate structure. Particularly, currently there exists no plausible and implementable solution for the time complexity reduction of quantum computers. Gate-model quantum computer implementations are affected by the problem of high time complexities and a universal (i.e., platform independent) and tractable solution for the time complexity reduction is essential. Relevant implication of this problem is the high economic cost of the physical apparatuses required for experimentally implementing practical quantum computation: specifically, the high economic cost of the high-precision quantum hardware elements required in the implementation of high-performance quantum circuits.

The quantum circuit of the quantum computer is modeled as an arbitrary quantum circuit with an arbitrary circuit depth formulated via a unitary sequence of L unitary operators. Each unitary is set via a particular Pauli operator and gate parameter (see also Section 2 for a detailed description). The input problem fed into the quantum computer is an arbitrary computational problem \({\mathscr{P}}\) with an objective function C. The C objective function is a subject of maximization via the quantum computer, i.e., via the unitaries of the circuit structure of the quantum computer. The objective function can model arbitrary combinatorial optimization problems9,10,42, large-scale programming problems10 such as the graph coloring problem, molecular conformation problem, job-shop scheduling problem, manufacturing cell formation problem, or the vehicle routing problem10. For a detailed description of input problems, we suggest2,3,4,8,9,10,42,43,44,45.

Another important application of gate-model quantum computations is the near-term quantum devices of the quantum Internet20,30,36,37,38,39,46,47,48,49,59,61,62,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93.

Here, we define a quantum algorithm for the time complexity reduction of any quantum circuit of quantum computers set up with an arbitrary number of unitary gates. The aim of the proposed framework is to reduce the time complexity of an arbitrary reference quantum circuit and a maximization of the objective function of the computational problem fed into the quantum computer. The method defines the reduced time complexity equivalent of the reference quantum circuit and recovers the reference output quantum state via the reduced time complexity quantum circuit (Note: the terminology of quantum state refers to an input or output quantum system, while the terminology of quantum gate refers to a unitary operator.). The reduced structures are determined via a pre-processing phase in the logical layer, and only the reduced time complexity quantum circuit and reduced quantum state are implemented in the physical layer. The pre-rocessing phase integrates a machine learning94,95,96,97 unit for the parameter optimization. The high complexity reference quantum circuit and reference quantum input are characterized only in the pre-processing phase without any physical level implementation. The framework applies a quantum algorithm on the output of the reduced quantum gate structure to recover the equivalent quantum state of the output quantum state of the non-reduced reference structure. In particular, the proposed framework and the defined quantum algorithm are universal since they have no requirements for the structure of the reference (e.g., non-reduced) quantum circuit subject to be reduced, for the number of unitaries in the reference structure, for the size of the input quantum state of the reference quantum circuit, nor for the dimensions of the actual quantum state. The quantum algorithm is defined as a fixed, auxiliary hardware component for an arbitrary quantum computer environment, with a pre-determined constant computational complexity as an auxiliary cost of the application of the algorithm. Specifically, we prove that the auxiliary cost of the proposed quantum algorithm is orders lower than the reachable amount of the reduction in time complexity, and the computational cost of the quantum algorithm becomes negligible in practice. The method also allows significantly reducing the economic cost of physical layer implementations, since the required elements and high-cost hardware components can be reduced in an experimental setting.

The novel contributions of our manuscript are as follows:

  1. 1.

    We define a quantum algorithm for circuit depth reduction of quantum circuits of gate-model quantum computers.

  2. 2.

    We define the computational cost of the proposed quantum algorithm and prove that it is significantly lower than the gainable reduction in time complexity.

  3. 3.

    The algorithm provides a tractable solution to reduce circuit depth and the economic cost of implementing the physical layer quantum computer by reducing quantum hardware elements.

  4. 4.

    The results are useful for experimental gate-model quantum computations and near-term quantum devices of the quantum Internet.

This paper is organized as follows. Section 2 defines the system model. Section 3 proposes the quantum algorithm and proves the computational complexity. Section 4 discusses the performance of the algorithm. Finally, Section 5 concludes the results. Supplemental material is included in the Appendix.

System Model

Let QG0 be a reference quantum circuit (quantum gate structure) with a sequence of L unitaries42, defined as

$$U(\vec{\theta })={U}_{L}({\theta }_{L}){U}_{L-1}({\theta }_{L-1})\ldots {U}_{1}({\theta }_{1}),$$
(1)

where \(\vec{\theta }\) is the L-dimensional vector of the gate parameters of the unitaries (gate parameter vector),

$$\vec{\theta }={({\theta }_{1},\ldots ,{\theta }_{L})}^{T},$$
(2)

and an i-th unitary gate Ui(θi) is evaluated as

$${U}_{i}({\theta }_{i})=\exp \,(\,-\,i{\theta }_{i}{P}_{i}),$$
(3)

where Pi is a generalized Pauli operator acting on a few quantum states (qubits in an experimental setting) formulated by the tensor product of Pauli operators {σx, σy, σz}42. Note, that \(U(\vec{\theta })\) in (1) identifies a unitary resulted from the serial application of the L unitary operators UL(θL)UL−1(θL−1) … U1(θ1), and for an input quantum state |φ〉,

$$U(\vec{\theta })|\varphi \rangle ={U}_{L}({\theta }_{L}){U}_{L-1}({\theta }_{L-1})\ldots {U}_{1}({\theta }_{1})|\varphi \rangle .$$
(4)

A qubit system example with a sequence of L unitaries is as follows. Let assume that the QG0 structure of the quantum computer consists of g single-qubit and m two-qubit unitaries, L = g + m, such that a j-th single-qubit gate realizes an \({X}_{j}={\sigma }_{x}^{j}\) operator, while a two-qubit gate realizes a \({Z}_{j}{Z}_{k}={\sigma }_{z}^{j}{\sigma }_{z}^{k}\) operator (see also42). Then, at a particular objective function C of an arbitrary computational problem subject of a maximization via the quantum computer, the \(U(\vec{\theta })\) sequence from (1) can be rewritten as

$$U(\vec{\theta })=U(B,\vec{\beta })U(C,\vec{\gamma }),$$
(5)

where

$$U(B,\vec{\beta })=\prod _{j}\,U({B}_{j},{\beta }_{j}),$$
(6)

where \(\vec{\beta }\) is the gate parameter vector of the g single-qubit unitaries,

$$\vec{\beta }={({\beta }_{1},\ldots ,{\beta }_{g})}^{T},$$
(7)

while B is defined as

$$B=\sum _{j}\,{X}_{j}$$
(8)

with

$${X}_{j}={\sigma }_{x}^{j},$$
(9)

and

$$U({B}_{j},{\beta }_{j})=\exp (-i{\beta }_{j}{X}_{j}),$$
(10)

where Bj = Xj, while the two-qubit unitaries are defined as

$$U(C,\vec{\gamma })=\prod _{\langle jk\rangle \in Q{G}_{0}}\,U({C}_{jk},{\gamma }_{jk}),$$
(11)

where 〈jk〉 QG0 is a physical connection between qubits j and k in the hardware-level of the QG0 structure of the quantum computer, \(\vec{\gamma }\) is the gate parameter vector of the m two-qubit unitaries

$$\vec{\gamma }={({\gamma }_{1},\ldots ,{\gamma }_{m})}^{T},$$
(12)

while

$$C=\sum _{\langle jk\rangle \in Q{G}_{0}}\,{C}_{jk},$$
(13)

where Cjk is a component of the objective function, while unitary U(Cjk, γjk) for a given 〈jk〉 is defined as

$$U({C}_{jk},{\gamma }_{jk})=U({Z}_{j}{Z}_{k},{\gamma }_{jk}{C}_{jk})=\exp (-i{\gamma }_{jk}{C}_{jk}{Z}_{j}{Z}_{k}),$$
(14)

where

$${Z}_{j}{Z}_{k}={\sigma }_{z}^{j}{\sigma }_{z}^{k}.$$
(15)

At a particular physical connectivity of QG0, the objective function C therefore can be written as

$$C(z)=\sum _{\langle jk\rangle \in Q{G}_{0}}\,{C}_{jk}(z),$$
(16)

where Cjk(z) is the objective function component evaluated for a given 〈jk〉, as

$${C}_{\langle jk\rangle }(z)=\frac{1}{2}(1-{z}_{i}{z}_{j}),$$
(17)

while z is an N-length input bitstring,

$$z={z}_{1}{z}_{2}\ldots {z}_{N},$$
(18)

where zi identifies an i-th bit, zi {−1, 1}.

For a given z, a |z〉 computational basis state is defined as

$$|z\rangle =|{z}_{1}{z}_{2}\ldots {z}_{N}\rangle ,$$
(19)

and the |ϕ〉 output system of QG0 is as

$$|\phi \rangle =U(\vec{\theta })|z\rangle ,$$
(20)

that can be evaluated further via (6) and (11), as

$$\begin{array}{rcl}|\phi \rangle & = & U(B,\vec{\beta })U(C,\vec{\gamma })|z\rangle \\ & = & \prod _{j}\,U({B}_{j},{\beta }_{j})\prod _{\langle jk\rangle \in Q{G}_{0}}\,U({C}_{jk}(z),{\gamma }_{jk})|z\rangle \\ & = & \prod _{j}\,\exp (-i{\beta }_{j}{X}_{j})\prod _{\langle jk\rangle \in Q{G}_{0}}\,\exp (-i{\gamma }_{jk}{C}_{jk}(z){Z}_{j}{Z}_{k})|z\rangle .\end{array}$$
(21)

To achieve the quantum parallelism, the input system |φ〉 = |X〉 of the quantum computer is set as an N-length d-dimensional (d = 2 for a qubit system) quantum state in the superposition of all possible dN states. For a qubit system, it means that input |X〉 is an N-qubit quantum state in a superposition of all possible 2N states |0〉 to |2N − 1〉, and the computations are performed on 2N states in parallel in the quantum computer.

Let |X〉 be a superposed input system of the non-reduced QG0 gate structure:

$$|X\rangle =\frac{1}{\sqrt{{d}^{N}}}\mathop{\sum }\limits_{{x}_{i}=1}^{{d}^{N}}\,|{x}_{i}\rangle ,$$
(22)

where |xi〉 is an i-th input state (represented as an N-length bit string for a qubit system), i = 1, …, n, n = dN, of the QG0 structure of the quantum computer.

To describe the parallel processing of the n input vectors of |X〉 (see (22)), {|x1〉, …, |xn〉} of |X〉 (see (22)) in the quantum computer, let \({\vec{\theta }}_{i}\) be the gate parameter vector associated with a given |xi〉 of |X〉:

$${\vec{\theta }}_{i}={({\theta }_{i,1},\ldots ,{\theta }_{i,L})}^{T}.$$
(23)

Let X be the classical representation of |X〉 in (22) to get

$$X=\frac{1}{\sqrt{{d}^{N}}}{({x}_{1},\ldots ,{x}_{n})}^{T},$$
(24)

where xi is the classical representation of |xi〉. (Note, that X and xi are not accessible in the quantum computer, since the quantum algorithm operates in the quantum regime on quantum states. The classical representation is used only as an abstracted auxiliary representation to describe the steps of the algorithm in a plausible manner).

Then, let \({U}_{0}(\vec{\theta })\) be the non-reduced gate structure matrix of QG0:

$${U}_{0}(\vec{\theta })=({U}_{0}({\vec{\theta }}_{n}){U}_{0}({\vec{\theta }}_{n-1})\ldots {U}_{0}({\vec{\theta }}_{1})),$$
(25)

where

$$\vec{\theta }=({\vec{\theta }}_{1},\ldots ,{\vec{\theta }}_{n})$$
(26)

and \({U}_{0}({\vec{\theta }}_{i})\) is the unitary sequence associated with |xi〉 in QG0, defined as

$${U}_{0}({\vec{\theta }}_{i})={U}_{L}({\theta }_{i,L}){U}_{L-1}({\theta }_{i,L-1})\ldots {U}_{1}({\theta }_{i,1}).$$
(27)

At an n-dimensional output vector

$$Y=\frac{1}{\sqrt{{d}^{N}}}{({y}_{1},\ldots ,{y}_{n})}^{T},$$
(28)

and the |Y〉 output quantum state of the non-reduced QG0 structure is

$$|Y\rangle ={U}_{0}(\vec{\theta })|X\rangle =\frac{1}{\sqrt{{d}^{N}}}\sum _{{y}_{i}}\,|{y}_{i}\rangle =\frac{1}{\sqrt{{d}^{N}}}\mathop{\sum }\limits_{{x}_{i}=1}^{{d}^{N}}\,{U}_{0}({\vec{\theta }}_{i})|{x}_{i}\rangle .$$
(29)

To define the reduced gate structure, QG*, it is necessary to find a reduced \(U({\vec{\theta }}_{i}^{{\prime} })\) with a reduced input \(|{\tilde{x}}_{i}\rangle \), for all i.

Then, let \(\tilde{X}\) be the classical representation of the reduced quantum state \(|\tilde{X}\rangle \) fed into QG*, as

$$\tilde{X}=\frac{1}{\sqrt{{n}^{\ast }}}{({\tilde{x}}_{1},\ldots ,{\tilde{x}}_{{n}^{\ast }})}^{T}$$
(30)

and

$$|\tilde{X}\rangle =\frac{1}{\sqrt{{n}^{\ast }}}\mathop{\sum }\limits_{{\tilde{x}}_{i}=1}^{{d}^{{N}^{\ast }}}|{\tilde{x}}_{i}\rangle ,$$
(31)

where N* is the number of d-dimensional (physical) quantum states that formulate \(|\tilde{X}\rangle \), n* = dN*, while the unitaries \(U(\vec{\theta }{\prime} )\) of QG* are

$$U(\vec{\theta }{\prime} )=(U({\vec{\theta }}_{{n}^{\ast }}^{{\prime} })U({\vec{\theta }}_{{n}^{\ast }-1}^{{\prime} })\ldots U({\vec{\theta }}_{1}^{{\prime} })).$$
(32)

where

$$\vec{\theta }{\prime} =({\vec{\theta }}_{1}^{{\prime} },\ldots ,{\vec{\theta }}_{{n}^{\ast }}^{{\prime} })$$
(33)

and \(U({\vec{\theta }}_{i}^{{\prime} })\) is the reduced unitary sequence associated with \(|{\tilde{x}}_{i}\rangle \), defined as

$$U({\vec{\theta }}_{i}^{{\prime} })={U}_{L}({\tilde{\theta }}_{i,L}){U}_{L-1}({\tilde{\theta }}_{i,L-1})\ldots {U}_{1}({\tilde{\theta }}_{i,1}).$$
(34)

The pre-processing phase determines output Z of QG* as a classical representation

$$Z=U(\vec{\theta }{\prime} )\tilde{X},$$
(35)

and the output quantum state |Z〉 of QG* therefore yields

$$|Z\rangle =U(\vec{\theta }{\prime} )|\tilde{X}\rangle .$$
(36)

The notations of the system model are also summarized in Table A.1 of the Supplemental Information.

Problem statement

Problems 1–3 summarize the problems to be solved.

Problem 1

Find a classical pre-processing \({\mathscr{P}}\) for calculating the \(|\tilde{X}\rangle \) reduced input system and the gate parameters of the QG* reduced time complexity gate structure.

Problem 2

Find a universal (independent of the number L of the unitaries in QG0) unitary operator UR with a set \({\mathscr{R}}\) of quantum registers to recover output |Yof the non-reduced QG0 structure from output |Zof the QG* reduced time complexity gate structure.

Problem 3

Determine the time complexity of UR and the reduction in the overall time complexity of QG*.

Theorems 1–3 give the resolutions of Problems 1–3.

The non-reduced time complexity quantum circuit QG0 (reference circuit) with an input quantum state |X〉 is showed in Fig. 1(a). Figure 1(b) depicts the system model for the problem resolution. The method is realized via unitary UR and \({\mathscr{P}}\) pre-processing, such that UR is implemented in the physical layer, while \({\mathscr{P}}\) is only a logical-layer process. Only the reduced input quantum state \(|\tilde{X}\rangle \) and the reduced quantum gate structure QG* must be built up in the physical layer to yield the reference output system |Y〉 of the reference circuit QG0 via |YR〉. In both cases, the output states are measured via a measurement M to get a classical bitring for the objective function evaluation. As a next step, the gate parameter values of the unitaries of the circuits are calibrated until an optimal objective function value is not reached. The calibration of the gate parameters is a separate optimization procedure and its aim is fundamentally differ from the aim of \({\mathscr{P}}\), and therefore it is not part of the circuit depth reduction method. Note that existing algorithms can be utilized for this task (such as a the algorithms proposed in19 and20, or some gradient independent methods98).

Figure 1
figure 1

(a) The non-reduced time complexity quantum circuit QG0 (reference circuit) with an input quantum state |X〉. The output of QG0 is |Y〉. The state |Y〉 is measured via a measurement M to get the classical string z to evaluate the objective function C(z). (b) System model of the time complexity reduction scheme. Pre-processing phase \({\mathscr{P}}\): the Y classical representation of output |Y〉 of QG0 is pre-processed by the pre-processing unit \({\mathscr{P}}\). Unit \({\mathscr{P}}\) contains a \({\mathscr{C}}\) computational block that outputs a vector κ, fed into an \({\mathscr{L}}\) machine learning control unit for the Δ error feedback. Unit \({\mathscr{P}}\) outputs \(\tilde{X}\) and the gate parameters of the reduced structure that defines QG*. Quantum phase: from \(\tilde{X}\) and the gate parameters, \(|\tilde{X}\rangle \) and QG* are set up. System \(|\tilde{X}\rangle \) is fed into the reduced quantum circuit QG*. The output of QG* is |Z〉, which is fed into the UR recovery quantum algorithm. The UR quantum operation outputs the |YR〉 system, which is the reference output |Y〉 of the reference circuit QG0. The state |YR〉 is measured via a measurement M to get the classical string zR to evaluate objective function C(zR).

Pre-processing

Theorem 1

There exists a \({\mathscr{P}}\) pre-processing to determine the \(|\tilde{X}\rangle \) input system and the \(U({\vec{\theta }}_{i}^{{\prime} })\) gate parameters, i = , …, n, for the reduced QG* gate structure for an arbitrary non-reduced QG0 structure with \(U({\vec{\theta }}_{i})\) and input |X〉.

Proof. The \({\mathscr{P}}\) pre-processing phase can be decomposed as \({\mathscr{P}}={\mathscr{C}}{\mathscr{L}}\), where \({\mathscr{C}}\) is a computational block, while \({\mathscr{L}}\) is a machine learning control block to calibrate the results of \({\mathscr{C}}\). We first define block \({\mathscr{C}}\), then discuss \({\mathscr{L}}\). The \({\mathscr{P}}\) pre-processing is a procedure to stabilize the output of the reduced quantum circuit. \({\mathscr{P}}\) is defined between the components \({\mathscr{C}}\) and \({\mathscr{L}}\) to evaluate \(|\tilde{X}\rangle \) and to set the gate parameters of the reduced quantum circuit structure QG* using the reference output |Y〉 of QG0. Note, as the output |YR〉 is fed into an M measurement block, the measurement results provide a feedback to calibrate \({\mathscr{P}}\) in every subroutine of the protocol to produce a final saturated output. The Δ output of the \({\mathscr{L}}\) machine learning control unit is used as a feedback in unit \({\mathscr{C}}\). For the definition of Δ, see (116) in Algorithm 1.

In the \({\mathscr{C}}\) computational block, the reduced \(U({\vec{\theta }}_{i}^{{\prime} })\) and \({\tilde{x}}_{i}\) are determined for i, in the following manner. Note, since \({\mathscr{P}}\) outputs the parameters of the reduced quantum gate structure, the extra complexity of a quantum structure can be replaced with classical complexity in the form of machine learning in the proposed framework.

Operation \({\mathscr{C}}\) sets a one-dimensional discrete cosine transform99 in the reduction method, thus a matrix G is defined as a generator matrix to evaluate the output coefficients of \({\mathscr{C}}\), see later (45). The definition of \({\mathscr{C}}\) (see later in (40)) comes from the fact that any U unitary operator can be rewritten via the cos and sin functions, and using cosine functions rather than sine functions is critical for a compression99. In our setting, this is because fewer cosine functions are needed to approximate a particular U unitary operator.

Let xi be the classical representation of |xi〉, and \({y}_{i}=U({\vec{\theta }}_{i}){x}_{i}\) be the classical representation of |yi〉. Using the sequences of the L unitaries in (29), define a matrix G with n coefficients ai, i = 1, …, n, as

$$\begin{array}{rcl}G & = & {(\begin{array}{ccc}{a}_{1} & \cdots & {a}_{n}\end{array})}^{T}\\ & = & (\begin{array}{c}(\Sigma \,{\theta }_{1})+{x}_{1}\\ (\Sigma \,{\theta }_{2})+{x}_{2}\\ \vdots \\ (\Sigma \,{\theta }_{n})+{x}_{n}\end{array})=(\begin{array}{c}({\Sigma }_{j=1}^{L}\,{\theta }_{1,j})+{x}_{1}\\ ({\Sigma }_{j=1}^{L}\,{\theta }_{2,j})+{x}_{2}\\ \vdots \\ ({\Sigma }_{j=1}^{L}\,{\theta }_{n,j})+{x}_{n}\end{array}),\end{array}$$
(37)

where

$$\Sigma \,{\theta }_{i}=\underset{j=1}{\overset{L}{\Sigma }}\,{\theta }_{i,j},$$
(38)

where θi,j identifies the gate parameter of a j-th unitary Ui,j(θ) associated to an i-th input xi, while unitary sequence \({U}_{0}({\vec{\theta }}_{i})\) to an i-th input xi is

$${U}_{0}({\vec{\theta }}_{i})=\exp (i\varSigma \,{\theta }_{i}{P}_{i}),$$
(39)

where Pi is a generalized Pauli operator.

First, the \({\mathscr{C}}\) operation (one-dimensional discrete cosine transform99) is applied to the input matrix G from (37),

$${\mathscr{C}}\,:\,\{{c}_{p},{f}_{i}\},0\le p,i\le n-1,$$
(40)

where cp is the p-th coefficient of \({\mathscr{C}}\),

$${c}_{p}=\mathop{\sum }\limits_{i=0}^{n-1}\,{A}_{p}{f}_{i}\,\cos \,\frac{\pi (2i+1)p}{2n},$$
(41)

where

$${f}_{i}=\mathop{\sum }\limits_{i=0}^{n-1}\,{A}_{p}{c}_{p}\,\cos \,\frac{\pi (2i+1)p}{2n},$$
(42)

and Ap is

$${A}_{p}=\{\begin{array}{l}\frac{1}{\sqrt{n}},\,{\rm{if}}\,p=0\\ \sqrt{\frac{2}{n}},\,{\rm{if}}\,1 < p < n\end{array}.$$
(43)

The coefficients of \({\mathscr{C}}\) defines matrix γ as

$$\begin{array}{rcl}\gamma & = & \chi G\\ & = & {({\varsigma }_{1}\cdot G,{\varsigma }_{2}\cdot G,\ldots ,{\varsigma }_{n}\cdot G)}^{T}\\ & = & {({c}_{1},{c}_{2},\ldots ,{c}_{n})}^{T},\end{array}$$
(44)

where · is the inner product,

$${c}_{i}={\varsigma }_{i}\cdot G=\mathop{\sum }\limits_{k=1}^{n}\,{\varsigma }_{i,k}\times {a}_{k},$$
(45)

where coefficients ak-s are given in (37), and χ is

$$\chi =(\begin{array}{c}{({\varsigma }_{1})}^{T}\\ \vdots \\ {({\varsigma }_{n-1})}^{T}\\ {({\varsigma }_{n})}^{T}\end{array}),$$
(46)

where ςi is an n-length vector

$${\varsigma }_{i}=({\varsigma }_{i,1},\ldots ,{\varsigma }_{i,n})={A}_{i}{\left(\cos \frac{i\pi }{2n},\cos \frac{3i\pi }{2n},\ldots ,\cos \frac{(2n-1)i\pi }{2n}\right)}^{T}.$$
(47)

Then, the n-length output vector κ of \({\mathscr{C}}\) is defined as

$${\mathscr{C}}(Y)=\kappa =\frac{1}{\sqrt{n}}{({\Omega }_{1},\ldots ,{\Omega }_{n})}^{T},$$
(48)

where Y is given in (28), while Ωi is as

$$\begin{array}{rcl}{\Omega }_{i} & = & U({\vec{\theta }}_{i}^{{\prime} }){\tilde{x}}_{i}\\ & = & {U}_{L}({\tilde{\theta }}_{i,L}){U}_{L-1}({\tilde{\theta }}_{i,L-1})\ldots {U}_{1}({\tilde{\theta }}_{i,1}){\tilde{x}}_{i}.\end{array}$$
(49)

Then, using the coefficients (41), (42) and (43) of \({\mathscr{C}}\), \(|{\tilde{x}}_{p}\rangle \) of the reduced state \(|\tilde{X}\rangle \) from (31) can be evaluated via the \({\tilde{x}}_{p}\) components of \(\tilde{X}\) of (30). A p-th input \(|{\tilde{x}}_{p}\rangle \) for QG* is defined via (49) as

$$|{\tilde{x}}_{p}\rangle =|{\Omega }_{p}{U}^{\dagger }({\vec{\theta }}_{p}^{{\prime} })\rangle =|\mathop{\sum }\limits_{i=0}^{n-1}\,{A}_{p}{x}_{i}\,\cos \,\frac{\pi (2i+1)p}{2n}\rangle ,$$
(50)

and the reduced quantum gate sequence \(U({\vec{\theta }}_{p}^{{\prime} })\) of \(|{\tilde{x}}_{p}\rangle \) in QG*, as

$$U({\vec{\theta }}_{p}^{{\rm{{\prime} }}})=\exp (i\Sigma {\tilde{\theta }}_{p}{P}_{p}),$$
(51)

where Pp is a generalized Pauli operator, and \(\Sigma {\tilde{\theta }}_{p}\) is as

$$\Sigma {\tilde{\theta }}_{p}=\mathop{\sum }\limits_{i=0}^{n-1}\,{A}_{p}(\Sigma {\theta }_{i})\cos \,\frac{\pi (2i+1)p}{2n}.$$
(52)

Therefore, the quantum state |Z〉 of QG* is

$$|Z\rangle =U(\vec{\theta }{\prime} )|\tilde{X}\rangle =\frac{1}{\sqrt{{d}^{{N}^{\ast }}}}\mathop{\sum }\limits_{{\tilde{x}}_{i}=1}^{{d}^{{N}^{\ast }}}\,U({\vec{\theta }}_{i}^{{\prime} })|{\tilde{x}}_{i}\rangle .$$
(53)

The description of the \({\mathscr{L}}\) machine learning control unit is as follows. Unit \({\mathscr{L}}\) uses the results of \({\mathscr{C}}\) to provide feedback for the pre-processing via supervised machine learning control.

The \({\mathscr{L}}\) machine learning algorithm for the pre-processing control is defined in Algorithm 1.

The steps of the \({\mathscr{P}}\) pre-processing method is given in Procedure 1.

Quantum Algorithm

Theorem 2

The |Youtput of the non-reduced QG0 structure can be recovered from the output |Zof the reduced structure QG* via a unitary operator UR.

Proof. Let \(|\tilde{X}\rangle \) be the input quantum state fed into the reduced structure QG*, and let |Z〉 (see (53)) be the output of the reduced gate structure. The task here is therefore to recover \(|Y\rangle ={U}_{0}(\vec{\theta })|X\rangle \) from |Z〉. The problem is solved via a unitary UR, as follows.

Without loss of generality, in an i-th step, i = 1, …, n, the goal of the UR operation is to calculate the quantum state as

$$|{\Phi }_{i}\rangle =|{\omega }_{i}\cdot \kappa \rangle ,$$
(54)

where κ is as in (48), while ωi = (ωi,1, …, ωi,n)T is an n-length vector defined for a given j, as

$${\omega }_{j}={\left({e}^{i(\Sigma {\theta }_{1}-\Sigma {\tilde{\theta }}_{1})}{A}_{j}\cos \frac{j\pi }{2n},\ldots ,{e}^{i(\Sigma {\theta }_{n}-\Sigma {\tilde{\theta }}_{n})}{A}_{j}\cos \frac{(2n-1)j\pi }{2n}\right)}^{T},$$
(55)

where ∑θi is as given in

$$\Sigma {\theta }_{i}=\mathop{\sum }\limits_{i=0}^{n-1}\,{A}_{p}(\Sigma {\tilde{\theta }}_{p})\cos \,\frac{\pi (2i+1)p}{2n},$$
(56)

where \(\Sigma {\tilde{\theta }}_{p}\) is given in (52).

Then let

$$W=(\begin{array}{c}{({\omega }_{1})}^{T}\\ \vdots \\ {({\omega }_{n-1})}^{T}\\ {({\omega }_{n})}^{T}\end{array}),$$
(57)

such that

$$W\kappa ={({\omega }_{1}\cdot \kappa ,\ldots ,{\omega }_{n}\cdot \kappa )}^{T}.$$
(58)

Applying UR for all i, yields the recovered quantum state |YR〉 as

$$\begin{array}{rcl}|{Y}_{R}\rangle & = & \mathop{\sum }\limits_{i=1}^{n}\,|{\Phi }_{i}\rangle =\mathop{\sum }\limits_{i=1}^{n}\,|{\omega }_{i}\cdot \kappa \rangle \\ & = & \frac{1}{\sqrt{n}}\mathop{\sum }\limits_{{x}_{i}=1}^{n}\,{e}^{i(\Sigma {\theta }_{i}-\Sigma {\tilde{\theta }}_{i})}U({\vec{\theta }}_{i}{\prime} )|{x}_{i}\rangle \\ & = & \frac{1}{\sqrt{{d}^{N}}}\mathop{\sum }\limits_{{x}_{i}=1}^{{d}^{N}}\,{U}_{0}({\vec{\theta }}_{i})|{x}_{i}\rangle \\ & = & {U}_{0}(\vec{\theta })|X\rangle ,\end{array}$$
(59)

where an i-th |xi〉 is as

$$|{x}_{i}\rangle =|\mathop{\sum }\limits_{i=0}^{n-1}\,{A}_{p}{\tilde{x}}_{p}\,\cos \,\frac{\pi (2i+1)p}{2n}\rangle ,$$
(60)

where i ≤ n − 1, and p ≥ 0, and \({\tilde{x}}_{p}\) is as given in (50); while the \({U}_{0}({\vec{\theta }}_{i})\) gate parameters (see (39)) of the L unitaries for a given i are evaluated as

$$\begin{array}{rcl}{U}_{0}({\vec{\theta }}_{i}) & = & {e}^{i(\Sigma {\theta }_{i}-\Sigma {\tilde{\theta }}_{i})}U({\vec{\theta }}_{i}^{{\prime} })\\ & = & {e}^{i(\Sigma {\theta }_{i}-\Sigma {\tilde{\theta }}_{i})}{e}^{i\Sigma {\tilde{\theta }}_{i}{P}_{i}}\\ & = & {e}^{i\Sigma {\theta }_{i}{P}_{i}}.\end{array}$$
(61)

The unitary UR is defined via a set \({\mathscr{R}}\) of quantum registers as

$${U}_{R}\,:\,{\mathscr{R}}=\{|{R}_{1}\rangle ,\ldots ,|{R}_{7}\rangle \},$$
(62)

where |Ri〉 is the i-th quantum register. The registers are initialized via set \({{\mathscr{R}}}_{0}\) as

$${{\mathscr{R}}}_{0}=\{\begin{array}{l}|{R}_{1}\rangle =|\partial \rangle ,|{R}_{2}\rangle =|\eta \rangle ,|{R}_{3}\rangle =|i\rangle ,|{R}_{4}\rangle =|\kappa \rangle ,\\ |{R}_{5}\rangle =|0\rangle ,|{R}_{6}\rangle =|0\rangle ,|{R}_{7}\rangle =|0\rangle \end{array}\},$$
(63)

where κ is given in (48), while ∂ and η are initial parameters defined as

$$\partial =\frac{{\Vert \kappa \Vert }^{2}}{n},$$
(64)

and

$$\eta ={\Vert \kappa \Vert }^{2},$$
(65)

where

$${\Vert \kappa \Vert }^{2}=\kappa \cdot \kappa =\mathop{\sum }\limits_{i=0}^{n-1}\,\frac{1}{n}({\Omega }_{i}\times {\bar{\Omega }}_{i})$$
(66)

where \({\Omega }_{i}=U({\vec{\theta }}_{i}^{{\prime} }){\tilde{x}}_{i}\), and

$$\partial \le \frac{1}{n}({y}_{i}\times {y}_{i})\le \eta ,$$
(67)

where \({y}_{i}=U({\vec{\theta }}_{i}){x}_{i}\).

Then, unitary UR is defined as

$${U}_{R}=(2|\psi \rangle \langle \psi |-I){U}_{S},$$
(68)

where

$$|\psi \rangle =\frac{1}{\sqrt{n}}\mathop{\sum }\limits_{i=0}^{n-1}\,|i\rangle ,$$
(69)

and US is a unitary defined as

$${U}_{S}={({U}_{0})}^{-1}{({O}_{{\Phi }_{i}})}^{-1}{O}_{{f}_{i}}{O}_{{\Phi }_{i}}{U}_{0},$$
(70)

with eigenstate

$$|{\Psi }_{S}\rangle =|\partial \rangle |\eta \rangle |i\rangle |\kappa \rangle |0\rangle |0\rangle |0\rangle ;$$
(71)

where U0 is an initial unitary operator that prepares state |R5〉 = |ωi〉 for a given index state |R4〉 = |i〉, where ωi is given in (55); from an initial |R4〉|R5〉 = |i〉|0〉 as

$${U}_{0}(|i\rangle |0\rangle )=|0\oplus {\omega }_{i}\rangle $$
(72)

in the register set \({{\mathscr{R}}}_{0}\) (see (63)), where \(\oplus \) is the CNOT operation, while \({O}_{{\Phi }_{i}}\) is an oracle applied on \({{\mathscr{R}}}_{0}\) to compute Φi (54), defined as

$$\begin{array}{c}{O}_{{\Phi }_{i}}({{\mathscr{R}}}_{0})={\mathscr{R}}{\prime} \\ :\,\{\begin{array}{l}|{R}_{1}\rangle =|\partial \rangle ,|{R}_{2}\rangle =|\eta \rangle ,|{R}_{3}\rangle =|i\rangle ,|{R}_{4}\rangle =|\kappa \rangle ,\\ |{R}_{5}\rangle =|{\omega }_{i}\rangle ,|{R}_{6}\rangle =|0\rangle ,|{R}_{7}\rangle =|{({\Phi }_{i})}^{2}\rangle \end{array}\},\end{array}$$
(73)

where \({\mathscr{R}}{\prime} \) is the resulting register set, while \({O}_{{f}_{i}}\) is an oracle that outputs function fi, as

$${O}_{{f}_{i}}\,:\,{f}_{i}=\{\begin{array}{l}1,\,{\rm{if}}\,\partial \le {\left(\frac{1}{\sqrt{n}}{y}_{i}\right)}^{2}\le \eta \\ 0,\,{\rm{otherwise}}\end{array}.$$
(74)

Specifically, note that (70) changes only the phase of the state as \({(-1)}^{{f}_{i}}\), where fi is given in (74), while

$${({U}_{0})}^{-1}{({O}_{{\Phi }_{i}})}^{-1}={({O}_{{\Phi }_{i}}{U}_{0})}^{-1}.$$
(75)

Applying (74) on (63) yields a register state \({O}_{{f}_{i}}({{\mathscr{R}}}_{0})\) as

$${O}_{{f}_{i}}({{\mathscr{R}}}_{0})={(-1)}^{{f}_{i}}{{\mathscr{R}}}_{0},$$
(76)

where \({(-1)}^{{f}_{i}}\) is the eigenvalue of US in (70).

Then, using the register set (63), let |ϕ0〉 be the input state for UR as

$$|{\phi }_{0}\rangle =\frac{1}{\sqrt{n}}\mathop{\sum }\limits_{i=0}^{n-1}\,|\partial \rangle |\eta \rangle |i\rangle |\kappa \rangle |0\rangle |0\rangle |0\rangle .$$
(77)

Applying (68) k-times on (77) yields

$$|{\phi }_{k}\rangle ={({U}_{R})}^{k}|{\phi }_{0}\rangle .$$
(78)

The k iteration number in (78) is a random number, k < c, where \(c=\,{\rm{\min }}\{1.2\cdot m,\sqrt{n}\}\), and m is initialized as m = 199.

Then let OZ be an oracle defined on \({\mathscr{R}}{\prime} \) as

$$\begin{array}{l}{O}_{Z}({\mathscr{R}}{\prime} )={{\mathscr{R}}}^{\ast }\\ :\,\{\begin{array}{l}|{R}_{1}\rangle =|\partial \rangle ,|{R}_{2}\rangle =|\eta \rangle ,|{R}_{3}\rangle =|i\rangle ,|{R}_{4}\rangle =|\kappa \rangle ,\\ |{R}_{5}\rangle =|{\omega }_{i}\rangle ,|{R}_{6}\rangle =|{\varPhi }_{i}\rangle ,|{R}_{7}\rangle =|0\rangle \end{array}\}.\end{array}$$
(79)

Applying OZU0 on (78), outputs system state

$$|{\phi }^{\ast }\rangle ={O}_{Z}{U}_{0}(|{\phi }_{k}\rangle ).$$
(80)

In particular, in system state (80), the state of register |R6〉 is

$$|{R}_{6}\rangle =\mathop{\sum }\limits_{i=1}^{n}\,|{\Phi }_{i}\rangle =|{Y}_{R}\rangle ,$$
(81)

therefore yields (59), such that

$$\partial \le {({\Phi }_{i})}^{2}\le \eta $$
(82)

holds for all i of |YR〉, due to the conditions set in the pre-processing procedure \({\mathscr{P}}\) (see (67)).

Assuming that the input system (77) for UR is prepared for R-times and the output register (81) is measured for R-times, i.e., UR is applied for R times in overall, in an r-th repetition, r = 1, …, R, the parameters of the procedure can be valuated as

$${\partial }^{(r)}=\frac{{\eta }^{(r)}}{n-{q}^{(r)}},$$
(83)

where

$${\eta }^{(r)}={\Vert {\kappa }^{(r)}\Vert }^{2}-({\Phi }_{i}^{(r)}\times {\Phi }_{i}^{(r)}),$$
(84)

where \({\Phi }_{i}^{(r)}\) is the measured value of |Φi〉 in the r-th repetition of UR, while q(r) is the number of coefficients have been already found99.

The actual value of r requires no increment if the relation

$${\tau }^{(r)} > \frac{1}{{\Vert \kappa \Vert }^{2}}{\eta }^{(r)},$$
(85)

holds, where τ(r) is a threshold value in the r-th iteration. Otherwise, the value of r can be increased, r = r + 1, as r < R.

The steps of the quantum algorithm UR are given in Algorithm 2.

Distortion measure

As (81) is prepared in Step 4 of UR, the state |YR〉 can be measured to get the classical string zR to evaluate objective function C(zR), as follows. Measure register |R6〉 of \({\mathscr{R}}\) via a measurement operator M to evaluate objective function C(zR), where zR is a classical string resulted from the measurement of |YR〉, while C is an objective function of an arbitrary computational problem fed into the quantum computer.

The \({\mathscr{D}}\) distortion coefficient associated with the |YR〉 recovered quantum state (59) can be evaluated at a particular objective function C, associated to the computational problem fed into the quantum computer as

$${\mathscr{D}}=|C(z)-C({z}_{R})|,$$
(86)

where z is a classical string resulting from the M measurement of |Y〉, while zR is a classical string resulting from the M measurement of |YR〉.

Precisely, assuming R measurement rounds, an average of distortion yields

$${{\mathscr{D}}}^{(R)}=\frac{1}{R}\mathop{\sum }\limits_{r=1}^{R}\,|{C}^{(r)}(z)-{C}^{(r)}({z}_{R})|,$$
(87)

where C(r)(z) and C(r)(zR) are the objective function values respectively associated with z and zR in the r-th round, r = 1, …, R.

Computational Complexity

Theorem 3

Quantum algorithm UR can be implemented with time complexity \({\mathscr{O}}(\sqrt{n})\) for the time complexity reduction of any non-reduced QG0 with an arbitrary number of L unitaries.

Proof. Let

$${\mathscr{G}}\{|i\rangle |b\rangle |c\rangle \}$$
(88)

be a global space spanned by |i〉, an n-dimensional vector |b〉, and by |c〉, which represents the inner product state.

Particularly, the UR unitary in (68) applied on an input |φ〉 formulated via set \({\mathscr{R}}\) of quantum registers gives

$$\begin{array}{rcl}|\varphi \rangle & = & \frac{1}{\sqrt{n}}\mathop{\sum }\limits_{i=0}^{n-1}\,|{\Psi }_{i}\rangle \\ & = & \frac{1}{\sqrt{n}}\mathop{\sum }\limits_{i=0}^{n-1}\,|\partial \rangle |\eta \rangle |i\rangle |\kappa \rangle |0\rangle |0\rangle |0\rangle ,\end{array}$$
(89)

where

$$|{\Psi }_{i}\rangle =|\partial \rangle |\eta \rangle |i\rangle |\kappa \rangle |0\rangle |0\rangle |0\rangle ;$$
(90)

thus UR can be interpreted as a rotation on an n-dimensional subspace \({\mathscr{S}}\{|i\rangle \}\), 0 ≤ i < n, i.e., on a span of all |i〉.

Let ∏ be the solution set with conditions (82) for all i of ∏,

$$\Pi =|\partial \rangle |\eta \rangle |i\rangle |\kappa \rangle |0\rangle |0\rangle |0\rangle ,$$
(91)

and let \(|\varUpsilon \rangle \in {\mathscr{S}}\{|i\rangle \}\) be the superposition of all solutions:

$$\begin{array}{rcl}|\varUpsilon \rangle & = & \frac{1}{\sqrt{|\Pi |}}\sum _{\xi \in \Pi }\,|\xi \rangle \\ & = & \frac{1}{\sqrt{|\Pi |}}\sum _{\xi \in \Pi }\,|\partial \rangle |\eta \rangle \sum _{\Pi }\,|i\rangle |\kappa \rangle |0\rangle |0\rangle |0\rangle .\end{array}$$
(92)

The operation UR on |φ〉 yields the state \(|{\phi }^{\ast }\rangle \in {\mathscr{S}}\{|i\rangle \}\) (see (80)):

$$\begin{array}{rcl}|{\phi }^{\ast }\rangle & = & {U}_{R}(|\varphi \rangle )\\ & = & |\partial \rangle |\eta \rangle \left[(2|\psi \rangle \langle \psi |-I)\mathop{\sum }\limits_{i=0}^{n-1}\,{(-1)}^{{f}_{i}}\frac{1}{\sqrt{n}}|i\rangle \right]|\kappa \rangle |0\rangle |0\rangle |0\rangle \\ & = & \frac{1}{\sqrt{n-|\Pi |}}\sum _{|\alpha \rangle \notin \Pi }\,|\alpha \rangle \\ & = & \frac{1}{\sqrt{n-|\Pi |}}|\partial \rangle |\eta \rangle (\sum _{I-\Pi }\,|j\rangle )|\kappa \rangle |0\rangle |0\rangle |0\rangle ,\end{array}$$
(93)

thus, UR is a rotation on the subspace \({\mathscr{S}}\{|{\phi }^{\ast }\rangle ,|\varUpsilon \rangle \}\) by angle \({\theta }_{{U}_{R}}\) towards (92), as

$${\theta }_{{U}_{R}}=2\arcsin \sqrt{\frac{|\Pi |}{n}},$$
(94)

where |∏| is the number of solutions (cardinality of solution set ∏).

UR can be implemented as a rotation of \({\theta }_{{U}_{R}}\) on subspace \({\mathscr{S}}\{|i\rangle \}\) (instead of a rotation on global space (88)) via a generalized quantum searching100 that yields time complexity \({\mathscr{O}}(\sqrt{n})\) for an arbitrarily large quantum circuit QG0. ■

Performance Evaluation

Assuming that the initial time complexity of the QG0 non-reduced gate structure is

$${\mathscr{O}}(NL),$$
(95)

where N is the number of d-dimensional (physical) quantum states in the superposed input system, and L is the number of unitaries in QG0, the time complexity of the reduced QG* structure is

$${\mathscr{O}}({N}^{\ast }{L}^{\ast }),$$
(96)

where N* is the number of d-dimensional (physical) quantum states in the reduced superposed input system, and L* is the number of unitaries in the reduced gate structure QG*.

Since the complexity of the proposed scheme is

$${\mathscr{O}}(\sqrt{n}),$$
(97)

the result of (96) is a reduced time complexity with respect to (95), as the relation

$${N}^{\ast }{L}^{\ast } < NL-\sqrt{n},$$
(98)

holds; thus

$${N}^{\ast }{L}^{\ast } < NL-{d}^{N/2}.$$
(99)

The overall complexity of the QG* reduced structure at the application of UR is therefore

$${\mathscr{O}}({N}^{\ast }{L}^{\ast }+\sqrt{n})={\mathscr{O}}({N}^{\ast }{L}^{\ast }+{d}^{N\mathrm{/2}})\mathrm{}.$$
(100)

Figure 2 depicts the resulting time complexities for a qubit implementation (N-qubit superposed input system, and qubit gate structure with L unitaries).

Figure 2
figure 2

The time complexities (number of operations) for an N-qubit system, d = 2, n = 2N, with an initial non-reduced gate structure QG0 with L unitaries, L = {10, 100, 1000, 10000}. The time complexity of QG0 is \({\mathscr{O}}(NL)\), while \({\mathscr{O}}(\ell )\) is an upper a bound on \({\mathscr{O}}({N}^{\ast }{L}^{\ast })\) of QG*, \({\mathscr{O}}(\ell )={\mathscr{O}}(NL-\sqrt{n})\).

To achieve time complexity reduction using \(|\tilde{X}\rangle \) and QG* instead of |X〉 and QG0, the relation \({\mathscr{O}}({N}^{\ast }{L}^{\ast }) < {\mathscr{O}}(\ell )={\mathscr{O}}(NL-\sqrt{n})\) must be straightforwardly satisfied, i.e., the initial complexity \({\mathscr{O}}(NL)\) has to be reduced by more than \({\mathscr{O}}(\sqrt{n})\). Since the complexity of the procedure is independent from the actual size of the gate structure, the cost remains constant \({\mathscr{O}}(\sqrt{n})\) for an arbitrarily large L.

Conclusions

Gate-model quantum computers are equipped with a collection of quantum states and unitary quantum gates. The realization of the quantum circuit of a quantum computer requires high fidelity, high precision, and high-level control. Since both the timecomplexity (depth of the circuits) and the economic costs of these implementations are high in practical scenarios, a reduction of these costs is essential. Here, we defined a quantum algorithm for reducing the circuit depth of gate-model quantum computers. The method achieves a reduction in the physical layer allowing significantly reducing implementation costs. The framework is flexible and can be used for arbitrary circuit depths.

Submission note

Parts of this work were presented in conference proceedings101.

Ethics statement

This work did not involve any active collection of human data.